﻿@model  Se.Framework.Web.Mvc.GenericCrud.GenericCrudViewModel
@*<link href="@Url.Content("~/Content/fileuploader/fileuploader.css")" rel="stylesheet" type="text/css" />*@
@*@Scripts.Render("~/bundles/fileuploader")*@
<section class="file-upload-section">
    <a href="#" id="importButton">Importar</a>
    @Ajax.ActionLink("Exportar", "ExportToExcel", new { entity = Model.Entity }, new AjaxOptions { })
    <div id="file-uploader">
        <noscript>
            <p>
                Please enable JavaScript to use file uploader.</p>
            <!-- or put a simple form for upload here -->
        </noscript>
    </div>
    <script type="text/javascript">
        var uploader = false;
        $(document).ready(function () {

            uploader = new qq.FileUploader({
                element: $("#file-uploader").get(0),
                uploadButtonText: "Subir Datos",
                button: $("#importButton").get(0),
                params: { entity: '@Model.Entity' },
                action: '@Url.Action("UploadFile")',
                allowedExtensions: ["csv"],
                acceptFiles: ".csv",
                onComplete: function (id, fileName, responseJSON) {
                    if (!responseJSON.success) {
                        alert(responseJSON.error);
                    }
                }
            });
        });
    </script>
</section>
